export function compare(property){
	return function(a,b){
	    var value1 = a[property];
	    var value2 = b[property];
	    return value2-value1;//降序排序
	}
}
// 获取当前页面路径
export function getCurrentRoute(){
	let pages = getCurrentPages(); //获取加载的页面
	let currentPage = pages[pages.length - 1]; //获取当前页面的对象
	return currentPage.route//当前页面url
	
}

// 时间搓转换
 export function FormatDate(timestamp,type){
	this.timestamp=timestamp;
	this.type=type;
 }
FormatDate.prototype.transferTime=function(){
	let date=new Date(this.timestamp);
	let Y=date.getFullYear();
	let M=(date.getMonth() + 1).toString().padStart(2,'0');
	let D=(date.getDate()).toString().padStart(2,'0');
	let H=date.getHours();
	let M2=date.getMinutes();
	let S=date.getSeconds();
	let obj={
		'Y-M-D/H:M2:S':Y+'-'+M+'-'+D+' '+H+':'+M2+':'+S,//年月日时分秒
		'Y-M-D':Y+'-'+M+'-'+D,//年月日
		'H:M2:S':H+':'+M2+':'+S,//时分秒
		'M-D':M+'-'+D,//月日
	}
	return obj[this.type]
}
